package com.jf.cloud.unicomdata.service.impl;

import com.jf.cloud.common.database.dto.PageDTO;
import com.jf.cloud.common.database.util.PageUtil;
import com.jf.cloud.common.database.vo.PageVO;
import com.jf.cloud.unicomdata.model.ScenicSpot;
import com.jf.cloud.unicomdata.mapper.ScenicSpotMapper;
import com.jf.cloud.unicomdata.service.ScenicSpotService;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

/**
 * 
 *
 * @author zz
 * @date 2023-04-24 18:39:33
 */
@Service
public class ScenicSpotServiceImpl implements ScenicSpotService {

    @Autowired
    private ScenicSpotMapper scenicSpotMapper;

    @Override
    public PageVO<ScenicSpot> page(PageDTO pageDTO) {
        return PageUtil.doPage(pageDTO, () -> scenicSpotMapper.list());
    }

    @Override
    public ScenicSpot getNameByCode(String code) {
        return scenicSpotMapper.getNameByCode(code);
    }

    @Override
    public void save(ScenicSpot scenicSpot) {
        scenicSpotMapper.save(scenicSpot);
    }

    @Override
    public void update(ScenicSpot scenicSpot) {
        scenicSpotMapper.update(scenicSpot);
    }

    @Override
    public void deleteById(Long id) {
        scenicSpotMapper.deleteById(id);
    }

    @Override
    public Map<String, Object> getDataByMiao() {
        return scenicSpotMapper.getDataByMiao().get(0);
    }

    @Override
    public Map<String, Object> getDataByMaTou() {
        return scenicSpotMapper.getDataByMaTou().get(0);
    }

    @Override
    public Map<String, Object> getDataByDongshan() {
        return scenicSpotMapper.getDataByDongshan().get(0);
    }

    @Override
    public void updateMiao(String day, String month) {
        scenicSpotMapper.updateMiao(day,month);
    }

    @Override
    public void updateDongshan(String day, String month) {
        scenicSpotMapper.updateDongshan(day,month);
    }

    @Override
    public void updateMaTou(String day, String month) {
        scenicSpotMapper.updateMaTou(day,month);
    }
}
